package com.heima.utils.threadlocal;

import com.heima.model.wemedia.pojos.WmUser;

/**
 * @author 胡慧
 * @title: WmThreadLocalUtils
 * @projectName heima-leadnews
 * @description: 图片上传需要携带token进行解析，解析后的用户放在当前线程中
 * @date 2021/2/220:05
 */
public class WmThreadLocalUtils {
    private final static ThreadLocal<WmUser> userThreadLocal=new ThreadLocal<>();
//    设置当前线程中的用户
    public static void setUser(WmUser wmUser){
        userThreadLocal.set(wmUser);
    }

    /**
     * 获取线程中的用户
     * @return
     */
    public static WmUser getUser(){
        return userThreadLocal.get();
    }
}
